#include <iostream>
using namespace std;

int main() {
    long long a,b,h,k;
    cin >> a >> h >> b >> k;
    long long sum = 0;

    int c1 = h / b;
    int c2 = k / a;
    int ans = min(c1,c2);
    h -= ans * b;
    k -= ans * a;
    if(h == 0 || k == 0)
    {
        
    }
    else {
        ans++;
        h -= b;
        k -= a;
    }

    sum += ans * (a + b);

    if(h > 0)
    {
        sum += a * 10;
    }
    if(k > 0)
    {
        sum += b * 10;
    }
    cout << sum << endl;
    return 0;
}
// 64 位输出请用 printf("%lld")